Ext.namespace("Despatch.Main");

Despatch.Main.tabIndex = {
	"temp" : 0,
	"finished":1,
	"search" : 2
};
Despatch.Main.tabs = [];

Despatch.initUI = function() {
	var opentab = Utils.getParameter('opentab');
	if (!opentab) opentab = "temp";	
	// init tabs
	Despatch.Main.tabs.push(new Despatch.Temp());
	Despatch.Main.tabs.push(new Despatch.Finished());	
	Despatch.Main.tabs.push(new Despatch.Search());
	Despatch.instance = new Ext.TabPanel({
		region: 'center',
		activeTab: Despatch.Main.tabIndex[opentab],
		items: Despatch.Main.tabs
	});
	
	var mainview = new Ext.Viewport({
        layout:'border',
        items:[Despatch.instance]
    });
};

Ext.onReady(function(){
	Ext.QuickTips.init();
    Ext.BLANK_IMAGE_URL = '../resources/images/default/s.gif';
	Despatch.initUI();
});

